#!/bin/bash

if [[ $DOCKER_TAG == 'latest' ]]; then
  REF='master'
else
  REF=$DOCKER_TAG
fi

if [[ $REF == 'dev' || $REF == 'stage' || $REF == 'master' ]]; then
  curl -X POST \
     --fail \
     -F token=$BUILD_TRIGGER_TOKEN \
     -F ref=$REF \
     -F "variables[component]=jet_bridge, jet_cloud" \
     -F "variables[jet_bridge]=true" \
     -F "variables[jet_cloud]=true" \
     https://gitlab.com/api/v4/projects/26239898/trigger/pipeline
fi